package design.pattern.decorator;

import design.pattern.Observer.User;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;

public class MainTest {

    public static void main(String[] args) throws IOException {
        Iwork iwork = new Student();
        System.out.println(iwork.work());


        JavaStudentDecorator javaStudentDecorator = new JavaStudentDecorator(new Student());
        System.out.println(javaStudentDecorator.work());


        JavaStudentWorkDecorator javaStudentWorkDecorator = new JavaStudentWorkDecorator(new JavaStudentDecorator(new Student()));
        System.out.println(javaStudentWorkDecorator.work());
////
        ObjectOutputStream objectOutputStream = new ObjectOutputStream(new FileOutputStream("D://a.txt"));
        objectOutputStream.writeObject(new User("111"));
        objectOutputStream.flush();
        objectOutputStream.close();
    }
}
